package com.song.module.app.controller;


import com.song.common.result.R;
import com.song.module.admin.entity.ApCookbook;
import com.song.module.admin.request.ApCollectRequest;
import com.song.module.admin.service.IApCollectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 收藏控制层
 *
 * @author song
 * @date 2024-02-28
 */
@Slf4j
@AllArgsConstructor
@RestController
@Api(value = "收藏接口管理", tags = "收藏接口管理")
@RequestMapping("/app/apCollect")
public class AppCollectController {

    private final IApCollectService iApCollectService;


    /**
     * 收藏
     */
    @ApiOperation(value = "收藏")
    @PostMapping("/collect")
    public R<Void> collect(@RequestBody ApCollectRequest apBannerRequest) {
        iApCollectService.collect(apBannerRequest);
        return R.success();
    }


    /**
     * 收藏列表
     */
    @ApiOperation(value = "收藏列表")
    @PostMapping("/list")
    public R<List<ApCookbook>> list(@RequestBody ApCollectRequest apBannerRequest) {
        return R.success(iApCollectService.mineCollect(apBannerRequest));
    }


}
